import java.util.Arrays;

public class J1902 {
public static void reverse(int[] arr1){
    int m = arr1.length;
    int[] arr2 = new int[m];
    int[] arr3 = new int[m];
    int i = 0;
    int j = 0;
    int k = 0;
    for(i = 0; i < m; i++){
        if(arr1[i] % 2 != 0){
            arr2[j] = arr1[i];
            j++;
        } else{
            arr3[k] = arr1[i];
            k++;
        }
    }
    for(i = 0; i < j; i++){
        arr1[i] = arr2[i];
    }
    for(j = 0; j < k; j++){
        arr1[i+j] = arr3[j];
    }
}
    public static void main(String[] args) {
        int[] arr1 = new int[]{1,7,9,5,8,15,6};
        reverse(arr1);
        String ret = Arrays.toString(arr1);
        System.out.println(ret);
    }
}
